<?php 
include('header.php');
include('menu.php');
include('config.php');
include_once('connection/connection.php');
$District_id=$_REQUEST['DT'];
$Block_id=$_REQUEST['BC'];
$type_scheme=$_REQUEST['TS'];
$s=$_REQUEST['s'];
//function call for removing blank space from an array
function blanck($var)
{
if($var!="")
{
    return $var;
}
}
//function call for convert id into name
function getName($colName,$id)
{
	$sqlgetName="select distinct ".$colName."_name from tbl_lookup_location where ".$colName."_id in(".$id.")";
	$querygetName=mysql_query($sqlgetName);
	while($rowgetName=mysql_fetch_row($querygetName))
	{
	$name=$name."-".$rowgetName[0];
	}

	$name=explode("-",$name);
	$name=array_filter($name, "blanck");
	return $name=implode($name,",");
}

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="js/validate.js"></script>
<script language="javascript" type="text/javascript">
function validate()
{
	valid = true;
	if (document.view_main_q1.district.selectedIndex == 0)
    {
        alert ( "Please select District Name" );
        valid = false;
    }
	if (document.view_main_q1.form_id.selectedIndex == 0)
    {
        alert ( "Please select Form Id" );
        valid = false;
    }
	return valid;
}	
</script>
<title> P&T </title>
</head>
<body>
<div align="center" style="margin-top:10px;">
<form action="" method="post" enctype="multipart/form-data" onSubmit="return validate()" name="view_main_q1">
	<table border="0" width="600" id="table1" cellspacing="0" cellpadding="0">
	<tr>
		<td height="29" align="left" valign="top" bgcolor="#C5D8EB" colspan="5">&nbsp;</td>
	</tr>
	<tr>
	<td bgcolor="#E5E5E5" align="center" colspan="5">
	<span lang="en-us">&nbsp;</span><span lang="en-us" style="font-size: 8.5pt"><font face="Verdana" color="#006699"><b><?php echo $type_scheme;?> scheme wise list</b></font></span></td>
</tr>
<tr><td bgcolor="#E5E5E5" align="left" colspan="5">&nbsp;</td>
</tr>
<tr><td width="86" height="35" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>District</b></font></td>
  <td width="172" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo getName('district',$District_id);?></font></td>
  <td width="109" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><b>Scheme</b></font></td>
  <td width="210" align="left">&nbsp;<font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $type_scheme;?></font></td>
  <td width="198" align="right"><a href="schemewiseListRWSS.php"><font face="Verdana" style="font-size: 8.5pt" color="#993333"><b>Back</b></font></a></td>
</tr>
		
		<tr>
			<td colspan="5">
			
<table width="786" bgcolor="#FFFFFF" style="border:1px solid #999999">
  <tr bgcolor="#E5E5E5">
    <td width="64" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Sr.No.</font></td>
     <td width="43" style="border:1px solid #999999" align="center"><font face="Verdana" style="font-size: 8.5pt" color="#000000">View</font></td>
	<td width="153" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Block</font></td>
    <td width="175" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;Scheme Name</font></td>
    <td width="327" style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">Census Village Code </font></td>
   
  </tr>
 <?php
$result=mysql_query("select block_id,name_scheme,id,cvc from tbl_dtls_q1_main where district_id='$District_id' and type_scheme='$type_scheme'");
     $i=1;
    while($fetchedRow=mysql_fetch_array($result))
	  {
     $Block_id=$fetchedRow['block_id'];  
	 $form_id= $fetchedRow['id'];     
 ?>
  <tr>
    <td style="border:1px solid #999999"><font face="Verdana" style="font-size: 8.5pt" color="#000000">&nbsp;<?php echo $i;?></font></td>
    <td style="border:1px solid #999999" align="center"><a href="q1_rwss_edit.php?form_id=<?php echo $form_id;?>" style="text-decoration:none"><img src="images/index.jpeg" width="16" height="16" border="0"></a></td>
	<td style="border:1px solid #999999;padding-left:5px"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo getName('block',$Block_id);?></font></td>
    <td style="border:1px solid #999999;padding-left:5px"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo $fetchedRow['name_scheme'];//getName('village',$villageId);?></font></td>
    <td style="border:1px solid #999999;padding-left:5px" valign="top"><font face="Verdana" style="font-size: 8.5pt" color="#000000"><?php echo wordwrap($fetchedRow['cvc'],60,"<br />\n", true);?></font></td>
    
  </tr>
  <?php
  $i++;
  }
  ?>
</table></td>
		</tr>
		<tr>
			<td colspan="5">&nbsp;</td>
		</tr>
	</table>
</form>
</div>
</body>
</html>
